package org.imaginedays.java.design.patter.newsimplefactory;

public class CashReturn extends CashSuper {
	
	private double moneyCondition = 0.0d;
	
	private double moneyReturn = 0.0d;
	
	

	public CashReturn(String moneyConditio, String moneyReturn) {
		super();
		this.moneyCondition = Double.parseDouble(moneyConditio);
		this.moneyReturn = Double.parseDouble(moneyReturn);
	}



	@Override
	public double acceptCash(double money) {
		double result = 0;
		if (money> moneyCondition) 
			result = money - Math.floor(money/moneyCondition)* moneyReturn;
		return result;
	}

}
